(function($){
		$.fn.auto = function(border){
			var children = $(this).children("*:not([autoheight])");
			var heightNow = 0;
			for(var i=0; i<children.length; i++){
				heightNow += $(children[i]).height();
				if(border){
					var bottom = $(children[i]).css("border-bottom-width");
					var top = $(children[i]).css("border-top-width");
                    var padding_bottom = $(children[i]).css("padding-bottom");
                    var padding_top = $(children[i]).css("padding-top");
                    var margin_bottom = $(children[i]).css("margin-bottom");
                    var margin_top = $(children[i]).css("margin-top");
                    if(bottom) heightNow += parseInt(bottom.substring(0,bottom.length-2));
					if(top) heightNow += parseInt(top.substring(0,top.length-2));
					if(padding_bottom) heightNow += parseInt(padding_bottom.substring(0,padding_bottom.length-2));
                    if(padding_top) heightNow += parseInt(padding_top.substring(0,padding_top.length-2));
                    if(margin_bottom) heightNow += parseInt(margin_bottom.substring(0,margin_bottom.length-2));
                    if(margin_top) heightNow += parseInt(margin_top.substring(0,margin_top.length-2));
				}
			}
			var autoBox = $(this).children('[autoheight]');
            for(var i=0; i<autoBox.length; i++){
				if(border){
					var bottom = $(autoBox[i]).css("border-bottom-width");
					var top = $(autoBox[i]).css("border-top-width");
                    var padding_bottom = $(autoBox[i]).css("padding-bottom");
                    var padding_top = $(autoBox[i]).css("padding-top");
                    var margin_bottom = $(autoBox[i]).css("margin-bottom");
                    var margin_top = $(autoBox[i]).css("margin-top");
                    if(bottom) heightNow += parseInt(bottom.substring(0,bottom.length-2));
					if(top) heightNow += parseInt(top.substring(0,top.length-2));
					if(padding_bottom) heightNow += parseInt(padding_bottom.substring(0,padding_bottom.length-2));
                    if(margin_bottom) heightNow += parseInt(margin_bottom.substring(0,margin_bottom.length-2));
                    if(margin_top) heightNow += parseInt(margin_top.substring(0,margin_top.length-2));
				}
			}
            var surplusHeight = $(this).height()-heightNow;
			$(autoBox).each(function(){
				$(this).height(surplusHeight*($(this).attr('autoheight')/100));
			});
			var autoChildren = $(this).children("*[auto=true]");
			$(autoChildren).each(function(){
				$(this).auto(border);
			});
		}
	})(jQuery)